//
//  UIBarButtonItem+Create.m
//  Weibo
//
//  Created by student on 16/4/25.
//  Copyright © 2016年 QiangTech. All rights reserved.
//

#import "UIBarButtonItem+Create.h"

@implementation UIBarButtonItem (Create)
+(UIBarButtonItem *)createBarButtomItem:(NSString *)imagename target:(id)target action:(SEL)select
{
    UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];
    [btn setImage:[UIImage imageNamed:imagename] forState:UIControlStateNormal];
    [btn setImage:[UIImage imageNamed:[imagename stringByAppendingString:@"_highlighted"]] forState:UIControlStateHighlighted];
    [btn addTarget:target action:select forControlEvents:UIControlEventTouchUpInside];
    [btn sizeToFit];
    
    return [[UIBarButtonItem alloc]initWithCustomView:btn];
}

@end
